package com.hejjon.service;

import com.hejjon.core.bean.TableColumn;
import com.hejjon.core.bean.TableField;
import com.hejjon.domain.pojo.FilterCondition;

import java.util.List;
import java.util.Map;

/**
 * @author: cs
 * @date: 2025-04-09 17:26:38
 * @since: 1.0
 */
public interface ISqlBuilderService {


    /**
     * 获取创建数据库的 sql
     */
    String createDB(String databaseName);

    String createDB(String databaseName, boolean deleteExist);
    /**
     * 删除若已存在库
     */
    String dropIfDatabaseExists(String databaseName);


    /**
     * 批量 删除若已存在库
     */
    List<String> batchDropDatabaseExists(List<String> dbNames);


    /**
     * 构建创建表SQL
     */
    String getCreateTableSql(String tableName, String tableComment, List<TableColumn> columnList);


    /**
     * 删除若已存在表
     */
    String dropIfTableExists(String tableName);

    /**
     * 删除若已存在表 批量
     */
    List<String> dropIfTableExists(String databaseName, List<String> tableNameList);

    String useDatabase(String databaseName);


    /**
     *
     * @param tableName  表名
     * @param fieldList  字段列表
     * @param valueList  字段值
     * @return 插入sql语句
     */
    String buildInsert(String tableName, List<TableField> fieldList, List<Map<String, Object>> valueList);



    String buildQueryScript(String tableName, List<TableField> fieldList, List<FilterCondition> conditionList, List<TableField> sortFieldList);

    /**
     * 构建更新语句
     */
    String buildUpdate(String tableName, List<TableField> fieldList);


}
